/*
 * Copyright (c) 2025 彭友聪
 * nativePC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2. 
 * You may obtain a copy of Mulan PSL v2 at:
            http://license.coscl.org.cn/MulanPSL2 
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
 * See the Mulan PSL v2 for more details.  
 * 
 * Author: 彭友聪 
 * email：2923616405@qq.com 
 * date: 2025/10/19 08:26
 * file: ${FILE_NAME}
 * product: DevEco Studio
 * LICENSE: MulanPSL-2.0
 * */
//
// Created on 2025/10/19.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef NATIVEPC_ARKUIBUTTONNODE_H
#define NATIVEPC_ARKUIBUTTONNODE_H
#include "ArkUINode.h"

#include <string>
namespace NativeModule
{
    class ArkUIButtonNode : public ArkUINode
    {
        public:
            ArkUIButtonNode()
                : ArkUINode(NativeModuleInstance::GetInstance()->GetNativeNodeAPI()->createNode(ARKUI_NODE_BUTTON))
            {
            }

            void SetEnable()
            {
                assert(handle_);
                ArkUI_NumberValue value[] = {{.i32 = 1}};
                ArkUI_AttributeItem item = {value, 1};
                nativeModule_->setAttribute(handle_, NODE_ENABLED, &item);
            }
            void SetLabel(const std::string &label) {
                assert(handle_);
                ArkUI_AttributeItem item = {nullptr, 0, label.c_str()};
                nativeModule_->setAttribute(handle_, NODE_BUTTON_LABEL, &item);
            }
    };
}

#endif //NATIVEPC_ARKUIBUTTONNODE_H
